package com.An.utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * @auther AnYang
 * @date 2022/4/11 16:34
 **/
public class CourseUtils {
	public static List<Integer> indexList = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
	public static List<String> timeList = Arrays.asList("7:30~8:10", "8:20~9:00", "9:10~9:50", "10:30~11:10", "11:20~12:00", "14:30~15:10", "15:20~16:00", "16:10~16:50", "17:00~17:40", "18:00~18:40", "18:50~19:30", "19:40~20:20", "20:30~21:10", "21:20~22:00");

	public static List<String> getRanInArr(String[] array) {
		//取随机数
	/*	int length=array.length;
		Random random = new Random();
		int index= (int) (Math.random()*length);
		return array[index];*/
		List<String> list = new ArrayList<>();
		int length = array.length;
		for (int i = 0; i < 5; i++) {
			int temp = (int) (Math.random() * length);
			list.add(array[temp]);
			array[temp] = array[length - 1];
			length--;
		}
		return list;

	}

	public static Boolean judge(String str, List<String> list) {
		boolean result = false;
		for (String s : list) {
			if (Objects.equals(str, s)) {
				result = true;
				break;
			}
		}
		return result;
	}

	public static List<String> getRanList(String[] array) {
		List<String> list = new ArrayList<>();
		int length = array.length;
		int n = length;
		for (int i = 0; i < n; i++) {
			int temp = (int) (Math.random() * length);
			list.add(array[temp]);
			array[temp] = array[length - 1];
			length--;
		}
		return list;
	}

}